#ifndef VENUS_GRAPHICS_UTILS_H
#define VENUS_GRAPHICS_UTILS_H

#include <string>
#include "common/venus.h"
#include "opengl.h"
#include "geometry/aabb.h"

namespace venus {
class TriangleMesh;
class ModelGL {
  enum PrimType { kNone = 0x0,
                  kPoints = 0x1,
                  kEdges = 0x2,
                  kTriangles = 0x4,
                  kTrianglesWithAdjacency = 0x8,
                  kAll = 0xf };
 public:
  ModelGL();
  ~ModelGL();
  void Initialize(const TriangleMesh *mesh, int opts = kTriangles);
  void SetData(const TriangleMesh *mesh);
  bool Draw();
  bool DrawWidthAdjacency();
  void DrawBound();
 private:
  GLuint point_array_id_;
  GLuint normal_array_id_;
  GLuint element_array_id_;
  const TriangleMesh *mesh_;
  AABB bound_;
  int *edge_indices_;
};
void DrawTriangleMesh(const TriangleMesh *mesh);
void DrawQuad(float x1, float y1, float x2, float y2);
void DrawQuad(float x1, float y1, float z1,
              float x2, float y2, float z2,
              float x3, float y3, float z3);
inline void DrawQuad() { DrawQuad(0, 0, 1, 1); }
void DrawCube(float x1, float y1, float z1,
              float x2, float y2, float z2);
void DrawTextGL(int x, int y, const char *text);
void DisplayStastics(const char *name, float data, const char *unit,
                     int x = 2, int y = 9);
GLuint MakeFullScreenQuad();
void VisualizeTexture(const ImageTextureGL &tex);

const std::string GetShaderPath(const char *filename);
} // namespace venus

#endif // VENUS_GRAPHICS_UTILS_H
